const {
    request
} = require('./request')
module.exports = {
    getBannerAPI(type = 'index') {
        return request('banner/list', 'GET', {
            type
        })
    },
    getfen() {
        return request('shop/goods/category/all', 'post')
    },
    // 宫格
    getgg() {
        return request('notice/last-one', 'GET')
    },
    // 秒杀
    getmiao(miaosha = "true") {
        return request('shop/goods/list/v2', 'POST', {
            miaosha
        })
    },
    // 爆品推荐
    gettui(recommendStatus = "1") {
        return request('shop/goods/list/v2', 'POST', {
            recommendStatus
        })
    },
    // 砍价
    getkan(kanjia = "true") {
        return request('shop/goods/list/v2', 'POST', {
            kanjia
        })
    },
    // 拼团
    getping(pingtuan = "true") {
        return request('shop/goods/list/v2', 'POST', {
            pingtuan
        })
    },
    // 商品列表
    getlist(data) {
        return request('shop/goods/list/v2', 'POST', data)
    },
    // 广告
    getggAPI(type = 'app') {
        return request('banner/list', 'GET', {
            type
        })
    },
    //自动登录与注册
    autoRegAndLoginApi(code) {
        return request('/user/wxapp/authorize', 'POST', {
            code
        })
    },

    //检测token是否有效
    checkTokenApi(token) {
        return request('/user/check-token', 'GET', {
            token
        })
    },

    //修改用户信息接口
    /**
     * 
     * @param {Object} data {nick,avatarUrl,gender,province,city,token}
     */
    updateUserInfoApi(data) {
        return request('/user/modify', 'POST', data)
    },
    //查看用户详情
    getUserDetailApi(token) {
        return request('/user/detail', 'GET', {
            token
        })
    },
    getxq(id) {
        return request('/shop/goods/detail', 'GET', {
            id
        })
    },
    getpingjia(goodsId) {
        return request('/shop/goods/reputation/v2', 'POST', {
            goodsId
        })
    },
    // 加入购物车
    getaddgwc(data) {
        return request('/shopping-cart/add', 'POST', data)
    },
    getaddgwcno(data) {
        return request('/shopping-cart/add', 'POST', data)
    },
    // 获取商品价格
    getgoodjiage(data) {
        return request('/shop/goods/price', 'post', data)
    },
    // 获取购物车数据
    getgwc(token) {
        return request('/shopping-cart/info', 'get', {
            token
        })
    },
    // 切换购物车状态
    getgwczt(data) {
        return request('/shopping-cart/select', 'POST', data)
    },
    // 购物车数量加1
    getgwcjia(data) {
        return request('/shopping-cart/modifyNumber', 'POST', data)
    },
    // 购物车数量减一
    getgwcjian(data) {
        return request('/shopping-cart/modifyNumber', 'POST', data)
    },
    // 删除购物车数据
    getgwcdel(data) {
        return request('/shopping-cart/remove', 'POST', data)
    },
}